package com.sugon.service.impl;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.RandomUtil;
import com.sugon.dao.ModuleRuntimeDurationDao;
import com.sugon.entity.ModuleRuntimeDurationEntity;
import com.sugon.service.ModuleRuntimeDurationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 模具运行时间段统计Service实现类
 *
 * @author sugon
 * @date 2021-11-20 09:49:18
 */
@Service("moduleRuntimeDurationService")
public class ModuleRuntimeDurationServiceImpl implements ModuleRuntimeDurationService {

    @Autowired
    private ModuleRuntimeDurationDao moduleRuntimeDurationDao;

    @Override
    public ModuleRuntimeDurationEntity queryObject(String id) {
        return moduleRuntimeDurationDao.queryObject(id);
    }

    @Override
    public List<ModuleRuntimeDurationEntity> queryList(Map<String, Object> map) {
        return moduleRuntimeDurationDao.queryList(map);
    }

    @Override
    public int queryTotal(Map<String, Object> map) {
        return moduleRuntimeDurationDao.queryTotal(map);
    }

    @Override
    public int save(ModuleRuntimeDurationEntity moduleRuntimeDuration) {
        moduleRuntimeDuration.setId(RandomUtil.randomString(32));
        moduleRuntimeDuration.setGmtCreate(DateUtil.date());
        return moduleRuntimeDurationDao.save(moduleRuntimeDuration);
    }

    @Override
    public int update(ModuleRuntimeDurationEntity moduleRuntimeDuration) {
        return moduleRuntimeDurationDao.update(moduleRuntimeDuration);
    }

    @Override
    public int delete(String id) {
        return moduleRuntimeDurationDao.delete(id);
    }

    @Override
    public int deleteBatch(String[] ids) {
        return moduleRuntimeDurationDao.deleteBatch(ids);
    }
}
